#ifndef FILE_FORMAT_BUILDER_H
#define FILE_FORMAT_BUILDER_H

#include "FileFormat/BaseFormat.hpp"

class BaseFileFormatBuilder {
public:
  virtual BaseFormat *Build() = 0;
  virtual std::string GetName() = 0;
};

template <class T> class FileFormatBuilder : public BaseFileFormatBuilder {
  const std::string name;
  T *ftype = nullptr;

public:
  FileFormatBuilder(const std::string &name_) : name(name_) {}
  virtual BaseFormat *Build() override final {
    return dynamic_cast<BaseFormat *>(new T);
  }
  virtual std::string GetName() override final { return name; }
};

#endif
